#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1005;
int n,dp[N][N],head,ans=1e18;
struct sss {
	int a,h;
} w[N] ;
inline int cmp(sss x,sss y) {
	return x.a<y.a ;
}
int p[N];
bool c[N];
void dfs(int now) {
	if(now>n) {
		int sum=0;
		for(int i=1;i<=n;i++) sum+=(w[p[i]].h-1)/w[p[i-1]].a*w[p[i]].a;
		ans=min(ans,sum);
		return ;
	}
	for(int i=1;i<=n;i++) if(!c[i]) {
		c[i]=1;
		p[now]=i;
		dfs(now+1);
		c[i]=0;
	}
}
signed main(){
	freopen("xinyue.in","r",stdin);
	freopen("xinyue.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>n>>w[0].a;
	w[0].h=0;
	for(int i=1;i<=n;i++) cin>>w[i].a>>w[i].h;
	bool flag=1;
	for(int i=1;i<n;i++) {
		if(!(w[i].a>w[i+1].a&&w[i].h<w[i+1].h)) {
			flag=0;
			break ;
		}
	}
	if(flag) {
		ans=(w[1].h-1)/w[0].a*w[1].a;
		int k=w[1].a;
		for(int i=2;i<=n;i++) {
			ans+=(w[i].h-1)/k*w[i].a;
		}
		cout<<ans;
		return 0;
	}
	sort(w+1,w+n+1,cmp);
	while(head<n&&w[head+1].a<=w[head].a) {
		swap(w[head+1],w[head]);
		head++;
	}
	if(head==n) {
		int sum=0;
		for(int i=0;i<n;i++) sum+=(w[i].h-1)/w[n].a*w[i].a;
		cout<<sum;
		return 0;
	}
	p[0]=0;
	dfs(1);
	cout<<ans;
	return 0;
}

